import json
from basic.Instance import *

def read_corpus(file_path):
    with open(file_path, mode='r', encoding="utf8") as inf:
        lines = []
        for line in inf.readlines():
            line = line.strip()
            if line != "":
                lines.append(line)
    return lines

def read_instances(s_file_path, t_file_path):
    s_sents = read_corpus(s_file_path)
    t_sents = read_corpus(t_file_path)

    s_len = len(s_sents)
    assert s_len == len(t_sents)
    

    insts = []
    for idx in range(s_len):
        inst = Instance()
        inst.s_sentence = s_sents[idx]
        inst.t_sentence = t_sents[idx]
        insts.append(inst)
    pass

    return insts